package MOLE.Pay;

import MOLE.*;

/** 
 CncardReceive ��ժҪ˵����
*/
public class CncardReceive
{
	private String text = MOLE.GetValue.GetRequesValue("c_order");
	private String text2 = MOLE.GetValue.GetRequesValue("c_ymd").trim();
	private String text3 = MOLE.GetValue.GetRequesValue("c_transnum").trim();
	private String text4 = MOLE.GetValue.GetRequesValue("c_succmark").trim().toUpperCase();
	private String text5 = MOLE.GetValue.GetRequesValue("c_cause");
	private String text6 = MOLE.GetValue.GetRequesValue("c_orderamount").trim();
	private String text7 = MOLE.GetValue.GetRequesValue("c_memo1").trim();
	private String text8 = MOLE.GetValue.GetRequesValue("c_memo2").trim();
	private String text9 = MOLE.GetValue.GetRequesValue("c_signstr").trim().toUpperCase();
	private long Oid = MOLE.GetValue.GetRequesLong("c_order");

	private String urlreturnok = MOLE.GetValue.GetConfigString("urlreturnok");
	private String demo = "";
	private int IsOk = 0;
	private String demo_sys = "";
	private String mysign = "";

	public CncardReceive()
	{
		mysign = _getMykey();
		 pro();
		_Rec();

		String url = urlreturnok + "?msg=" + demo + "&money=" + String.format("%0.2f", MOLE.str.ConverToDecimal(text6)) + "&oid=" + String.valueOf(Oid);
		HttpContext.Current.Response.Redirect(url);
	}


	public final void pro()
	{
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#region
		if (1 == 0)
		{
		}
		 else if (!text9.equals(mysign))
		 {
			demo = "md5У��ʧ�ܣ�ת��ʧ��";
		 }
		 else if (!text4.equals("Y"))
		 {
			demo = "ת��ʧ�ܣ�ԭ��" + text5;
		 }
		 else
		 {
			//comple order 
			Order o = new Order(Oid);
			o.Exec();
			if (o.status == 0) //successs
			{
				IsOk = 1;
			}
			demo = o.statusStr;
		 }
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#endregion

	}



	public final void _Rec()
	{
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#region
		try
		{
			MOLE.SQLOS o = new MOLE.SQLOS("netgatelog");

			o.RS("nOid", Oid);
			o.RS("nTradeStatus", text4);
			o.RS("nTradeIsSuccess", text4);
			o.RS("nLogistics_fee ", 0);
			o.RS("nNotifytype", "--");
			o.RS("nATN ", "--");
			o.RS("nSign ", text9);
			o.RS("nMysign", mysign);
			o.RS("nIsOk", IsOk);
			o.RS("nDemo", demo);
			o.Insert();
			// HttpContext.Current.Response.Write( 	o.InsertSql );
		}
		catch (RuntimeException ee)
		{
			Log.Add("netgatelog eerr:  " + ee.toString());

		}
		finally
		{
		{
			//if(demo_sys!="")
			Log.Add(demo_sys);
		}
		}


//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#endregion

	}




	public final String _getMykey()
	{
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#region
		String text11 = FormsAuthentication.HashPasswordForStoringInConfigFileuniquetempvar.toUpperCase();
		return text11;

//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#endregion
	}





}